home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / DIALOGS / JANUSW / VBXDEMO.PAS < prev    next >
Pascal/Delphi Source File  |  1994-11-14  |  2KB  |  93 lines

  1. { Program:   VbxDemo
  2.   Version:   1.00
  3.   Purpose:   this simple program demonstrates how to use of Vbx controls with
  4.              Borland Pascal and tDialogWindow
  5.   Uses:      BIVBX10.DLL and GAUGE.VBX from the BC4 package
  6.  
  7.   Developer: Peter Sawatzki (ps)
  8.              Buchenhof 3, D58091 Hagen, Germany
  9.  CompuServe: 100031,3002
  10.  
  11.   Date:     Author:
  12.   02/25/94  ps       written
  13.  
  14.   Copyright (c) 1994 Peter Sawatzki. All Rights Reserved.
  15. }
  16. Program VbxDemo;
  17. {$A+,B-,F-,G+,I-,K+,P-,Q-,R-,S-,T-,V-,X+}
  18. {$R VbxDemo.Res}
  19. Uses
  20.   WinProcs,
  21.   oWindows,
  22.   oDialogs,
  23.   WinTypes,
  24. {$IfDef Debug} Debug, {$EndIf}
  25.   Vbx,
  26.   DialogWn;
  27. Const
  28.   VBXvalidation: tVbxValidation = cVbxValidation;
  29.  
  30. Type
  31.   pGaugeControl = ^tGaugeControl;
  32.   tGaugeControl = Object(tVbxControl)
  33.     Procedure evMouseMove (Var Event: tVbxEvent); Virtual ev_First+0;
  34.   End;
  35.  
  36.   pVbxWindow = ^tVbxWindow;
  37.   tVbxWindow = Object(tDialogWindow)
  38.     Gauge1: pGaugeControl;
  39.     Option1,
  40.     Option2: pVbxControl;
  41.     Constructor Init (aParent: pWindowsObject; Name: pChar);
  42.     Procedure SetupWindow; Virtual;
  43.   End;
  44.  
  45. Procedure tGaugeControl.evMouseMove (Var Event: tVbxEvent);
  46. Begin
  47.   {$IfDef Debug} WriteLn('[tBIGAUGE.evMouseMove]'); {$EndIf}
  48.   WriteLn('Shift= ',Integer(GetEventArg(Event, 2)^),
  49.           ' x= ',Integer(GetEventArg(Event, 3)^),
  50.           ' y= ',Integer(GetEventArg(Event, 4)^));
  51. {4 params: Integer Integer Integer Integer
  52.  descr= Button As Integer,Shift As Integer,X As Integer,Y As Integer}
  53. End;
  54.  
  55. Constructor tVbxWindow.Init (aParent: pWindowsObject; Name: pChar);
  56. {-Create a new DialogWindow with VBX childs}
  57. Begin
  58.   Inherited Init(aParent, Name);
  59.   Gauge1:= New(pGaugeControl, InitResource(@Self, 100));
  60.   Option1:= New(pVbxControl, InitResource(@Self, 101));
  61.   Option2:= New(pVbxControl, InitResource(@Self, 102));
  62. End;
  63.  
  64. Procedure tVbxWindow.SetupWindow;
  65. Begin
  66.   Inherited SetupWindow;
  67. End;
  68.  
  69. {-------------------- the Application part }
  70. Const
  71.   ProgName = 'VbxDemo';
  72. Type
  73.   tProgApp = Object(tAdvApplication)
  74.     Procedure InitMainWindow; Virtual;
  75.   End;
  76.  
  77. Procedure tProgApp.InitMainWindow;
  78. Begin
  79.   MainWindow:= New(pVbxWindow, Init(Nil, ProgName))
  80. End;
  81.  
  82. Var
  83.   App: tProgApp;
  84. Begin
  85.   RegisterVBX(VBXvalidation);
  86.   With App Do Begin
  87.     Init(ProgName);
  88.     Run;
  89.     Done
  90.   End
  91. End.
  92.  
  93.